@extends('admin.layout.main')
@section('content')
    <div class="main-content-inner">
        <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="/admin/index">首页</a>
                </li>

                <li>
                    <a href="/admin/config">系统设置</a>
                </li>
                <li class="active">
                    <span>编辑条例</span>
                </li>
            </ul><!-- /.breadcrumb -->

            <div class="nav-search" id="nav-search">
                <form class="form-search">
								<span class="input-icon">
									<input type="text"  placeholder="Search ..." class="nav-search-input"
                                           id="nav-search-input" autocomplete="off"/>
									<i class="ace-icon fa fa-search nav-search-icon"></i>
								</span>
                </form>
            </div><!-- /.nav-search -->
        </div>

        <div class="page-content">


            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->
                    <form class="form-horizontal" role="form" name="linkform" method="post" action="/admin/config/{{$list->id}}">
                        {{csrf_field()}}
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-1">条例类型 </label>

                            <div class="col-sm-9">
                                <input type="text" value="{{$list->key}}" name="key" id="form-field-1" placeholder="填写文章标题"
                                       class="col-xs-10 col-sm-5"/>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-1">类型 </label>
                            <div class="col-sm-9">
                                <select name="my_type" id="my_type" class="col-xs-10 col-sm-5">
                                    <option value="1" selected="selected">文本框</option>
                                    <option value="2">编辑器</option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group" id="value1">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-2">文章内容</label>

                            <div class="col-sm-9">
                                <textarea id="" name="value1" class="col-xs-8 col-sm-8"
                                          style="overflow-wrap: break-word; resize: horizontal; padding-left: 0;height:100px;width:525px;">{{$list->value}}</textarea>
                            </div>
                        </div>

                        <div class="form-group" id="value2">
                            <label class="col-sm-3 control-label no-padding-right" for="form-field-2">文章内容</label>

                            <div class="col-sm-9">
                                <textarea id="form-field-2" class="col-xs-8 col-sm-8 autosize-transition"
                                          style="overflow-wrap: break-word; resize: horizontal; padding-left: 0">{{$list->value}}</textarea>
                            </div>
                        </div>
                        <div class="space-4"></div>


                        <input type="hidden" name="id" value="{{$list->id}}">
                        <input type="hidden" name="_method" value="put">
                        <div class="space-4"></div>

                        <div class="clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                <button id="submitBtn" class="btn btn-info" type="submit">
                                    <i class="ace-icon fa fa-check bigger-110"></i>
                                    提交
                                </button>
                                <button class="btn" type="reset">
                                    <i class="ace-icon fa fa-undo bigger-110"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>

    <!-- 配置文件 -->
    <script type="text/javascript" src="{{asset('admin/ueditor1_4_3_3/ueditor.config.js')}}"></script>
    <!-- 编辑器源码文件 -->
    <script type="text/javascript" src="{{asset('admin/ueditor1_4_3_3/ueditor.all.js')}}"></script>
    <!-- 实例化编辑器 -->
    <script type="text/javascript">
        var ue = UE.getEditor('form-field-2',{
            autoHeightEnabled: true,
            autoFloatEnabled: true,
            textarea:'value',
        });

        $(function(){
            $("#value1").show();
            $("#value2").hide();
        });
        $("#my_type").change(function(){
            if($("#my_type").val() == 1) {
                $("#value1").show();
                $("#value2").hide();
            } else if($("#my_type").val() == 2) {
                $("#value2").show();
                $("#value1").hide();
            }
        });

    </script>
@endsection